package netbayWatchDog;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;

public class WatchDogUtility {

	public static void initialize()
	{
		Properties prop = new Properties();
		FileInputStream fis;
		try {
			fis = new FileInputStream("config.properties");
		} catch (FileNotFoundException e2) {
			System.out.println("can't find the properties.xml");
			return;
		}
		try {
			prop.load(fis);
		} catch (IOException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		}
//		prop.list(System.out);

		WatchDog.servletUrl = prop.getProperty("BizUrl");
		WatchDog.TCDRecvDir = prop.getProperty("TCDRecvDir");
		WatchDog.cycleDelay = Integer.parseInt(prop.getProperty("cycleDelay"));
		WatchDog.TCDRecvCmd = prop.getProperty("TCDRecvCmd");
		WatchDog.JPMCRecvCmd = prop.getProperty("JPMCRecvCmd");
		WatchDog.UpdateDbCmd = prop.getProperty("UpdateDbCmd");
		SFTPManager.SFTPuser = prop.getProperty("SFTPuser");
		SFTPManager.SFTPhost = prop.getProperty("SFTPhost");
		SFTPManager.SFTPport = Integer.parseInt(prop.getProperty("SFTPPort"));
		SFTPManager.SFTPprivateKeyPath = prop.getProperty("SFTPprivateKeyPath");
		SFTPManager.SFTPpassPhrase = prop.getProperty("SFTPpassPhrase");
		SFTPManager.SFTPknowHostStrict = prop.getProperty("SFTPknowHostStrict").equalsIgnoreCase("true");
		SFTPManager.SFTPrecvPath = prop.getProperty("SFTPrecvPath");

	}
}
